## Main makefile for LottoLuck
# Author: mtreece
# Date: 02/08/2010
# 
#

CC = g++
FLAGS = -Wall -Wextra -O3

# Directory of LottoLuck source files
SRC = ./src

# Directory to put LottoLuck object files
OBJ = ./obj

menu:
	@echo "Please specify what to make..."
	@echo "  1) make lottoluck  # the main program you probably want"
	@echo "  2) make clean      # remove *.o"


## Update this main Make as necessary
lottoluck: $(OBJ)/LottoLuck.o $(OBJ)/ConfReader.o $(OBJ)/Ticket.o $(OBJ)/TicketLine.o $(OBJ)/MoneyWorth.o $(OBJ)/Definitions.o $(OBJ)/IntArraySort.o
	$(CC) $(FLAGS) -o lottoluck $(OBJ)/LottoLuck.o $(OBJ)/ConfReader.o $(OBJ)/Ticket.o $(OBJ)/TicketLine.o $(OBJ)/MoneyWorth.o $(OBJ)/Definitions.o $(OBJ)/IntArraySort.o

$(OBJ)/Definitions.o: $(SRC)/Definitions.cpp $(SRC)/Definitions.h
	$(CC) $(FLAGS) -c $(SRC)/Definitions.cpp -o $(OBJ)/Definitions.o

$(OBJ)/Ticket.o: $(SRC)/Ticket.cpp $(SRC)/Ticket.h $(OBJ)/MoneyWorth.o $(OBJ)/TicketLine.o
	$(CC) $(FLAGS) -c $(SRC)/Ticket.cpp -o $(OBJ)/Ticket.o

$(OBJ)/TicketLine.o: $(SRC)/TicketLine.cpp $(SRC)/TicketLine.h $(OBJ)/MoneyWorth.o $(OBJ)/IntArraySort.o
	$(CC) $(FLAGS) -c $(SRC)/TicketLine.cpp -o $(OBJ)/TicketLine.o

$(OBJ)/IntArraySort.o: $(SRC)/IntArraySort.cpp $(SRC)/IntArraySort.h
	$(CC) $(FLAGS) -c $(SRC)/IntArraySort.cpp -o $(OBJ)/IntArraySort.o

$(OBJ)/ConfReader.o: $(SRC)/ConfReader.cpp $(SRC)/ConfReader.h
	$(CC) $(FLAGS) -c $(SRC)/ConfReader.cpp -o $(OBJ)/ConfReader.o

$(OBJ)/LottoLuck.o: $(SRC)/LottoLuck.cpp $(SRC)/LottoLuck.h
	$(CC) $(FLAGS) -c $(SRC)/LottoLuck.cpp -o $(OBJ)/LottoLuck.o

$(OBJ)/MoneyWorth.o: $(SRC)/MoneyWorth.cpp $(SRC)/MoneyWorth.h
	$(CC) $(FLAGS) -c $(SRC)/MoneyWorth.cpp -o $(OBJ)/MoneyWorth.o

## Compile everything together and use tester.cpp's main
## to test various functionality
tester: *.cpp
	$(CC) $(FLAGS) -o tester $(SRC)/*.cpp

## ability to clean up directory...
## ... useful for starting with a fresh build.
clean:
	rm $(OBJ)/*.o
